#ifndef _SEMAPHORE_H
#define _SEMAPHORE_H

#include "common.h"
#include "list.h"

#define  MUTEX_COUNT_MAX      (10)

typedef u8 SemaphoreHandle_t;

typedef struct mutex
{
  u16 id;
  u8 lock_status;
  ListObj mutex_node;
} MutexObj_t;


/* export api */
MutexObj_t *mutex_create(void);
unsigned char mutex_isExist(MutexObj_t* obj);
void mutex_delete(MutexObj_t *obj);
unsigned int get_mutex_nums(void);
void mutex_give(MutexObj_t *obj);
int mutex_take(MutexObj_t *obj);
u16 get_mutex_id(MutexObj_t* obj);


#endif